import os

from openai import OpenAI
#普通对话
messages = [
    {"role":"system","content":"You area a helpful assistant."},
    {"role":"user","content":"Who won the World Series in 2020?"},
    {"role":"assistant","content":"The Los Angeles Dodgers won the World Series in 2020."},
    {"role":"user","content":"Where was it played?Answer it in Simplified Chinese."},
]

#client = OpenAI(api_key="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", base_url="https://api.openai.com/v1")
client = OpenAI(api_key="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", base_url="https://api.openai-proxy.com/v1")
response = client.chat.completions.create(messages=messages, model="gpt-4o",max_completion_tokens=2000)

#欧也可调用的模型列表
# print([model.id for model in client.models.list().data])

print(response.choices[0].message.content)

